package com.hgts.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hgts.common.R;
import com.hgts.pojo.Details;
import com.hgts.pojo.dto.BookDto;
import com.hgts.service.IBookService;
import com.hgts.service.IDetailsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.web.PagedResourcesAssembler;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 曹怀金
 * @since 2023-05-03
 */
@RestController
@RequestMapping("/details")
@Slf4j
public class DetailsController {

    @Autowired
    private IDetailsService detailsService;

    @Autowired
    private IBookService bookService;


    /**
     * 查询图书借阅信息
     * @param page
     * @param pageSize
     * @param name
     * @return
     */
    @GetMapping("/page")
    public R<Page> page(int page, int pageSize, String name){

        return detailsService.pageInfo(page,pageSize,name);
    }

    /**
     * 拉入黑名单
     */
    @DeleteMapping
    public R<String> joinBooks(int[] ids){
        return detailsService.joinBooks(ids);
    }

    /**
     * 删除黑名单
     */
    @DeleteMapping("/return")
    public R<String> delBooks(int[] ids){
        return bookService.dleBooks(ids);
    }

    /**
     * 查询失信人员
     */
    @GetMapping("/pageR")
    public R<Page> pageR(int page, int pageSize, String name){

        return detailsService.pageInfoR(page,pageSize,name);
    }


}

